<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据数据代理</title>
</head>
<body>
    <script>
        let person = {
            name: '张三',
            sex: '男'
        }
        console.log(Object.keys(person));
        Object.defineProperty(person, 'nickName', {
            value: person.name,
            enumerable: true,
            writable:true,
            get: function() {
                return person.name
            },
            set: function(value) {
                person.name = value
            }
        })
        console.log(person);
        console.log(Object.keys(person));
    
    </script>
</body>
</html>